<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RegisterLogInfo
 *
 * @author ziad
 */
class RegisterLogInfo extends BaseUsersLoginForm {

    public function configure() {
        $this->useFields(array('username', 'password'));

        # Edit defualt widget Schema
        $this->widgetSchema['step'] = new sfWidgetFormInputHidden();
        
        $this->validatorSchema['username'] = new sfValidatorAnd(array($this->validatorSchema['username'],
                                                                            new sfValidatorDoctrineUnique(array('model'=>'UsersLogin', 'column'=>'username'), array('invalid'=>'this username is already used', 'required'=>true))
                                                                            ));

        $this->widgetSchema['password'] = new sfWidgetFormInputPassword();

        $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();

        # Edit default validator Schema
        $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];

        $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));

        $this->validatorSchema->addOption('allow_extra_fields', true);

        $this->setDefaults(array('step' => 1));
    }

}

?>
